<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>抽奖调查</title>

    <!-- Bootstrap core CSS -->
    <link href="../../dist/css/bootstrap.min.css" rel="stylesheet">

    <link rel="stylesheet" href="css/typo/typo.css">
    <link rel="stylesheet" href="css/GB-canvas-turntable.css">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="../../assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="../../assets/js/ie-emulation-modes-warning.js"></script>

    <style>
        .wrapper {
            padding: 20px 40px;
        }
        
        .gb-turntable a.gb-turntable-btn {
            border: none;
        }
        
        #container {
            margin: 0 auto;
            text-align: center;
            height: auto;
        }
        
        body {
            text-align: center;
        }
    </style>
</head>

<body ontouchstart>

    <div class="wrapper  container" id="wrapper">

        <div class="jumbotron">
            <p>为感谢广大消费者一直以来对家乐超市的支持，该超市将在国庆7天进行抽奖活动。您所抽到的购物券全场通用，以“欢度国庆 感恩回馈 真情放送”为原则，让广大消费者在超市购物买的放心，用的放心。</p>
            <h2>快来试试您的手气吧！</h2>
        </div>

        <section id="turntable" class="gb-turntable">
            <div class="gb-turntable-container">
                <div id="container">
                    <canvas class=" gb-turntable-canvas " width="600px " height="600px ">抱歉！浏览器不支持。</canvas>
                </div>
            </div>
            <a class="gb-turntable-btn " href="javascript:; ">抽奖</a>
        </section>



        <div class=".col-sm-3" style="position:absolute; right:120px; top:300px;">
            <h2>您可能会抽到</h2>
            <br>
            <ul class="list-group" style="font-size:18px;">
                <li class="list-group-item"><span class="badge">1</span>谢谢惠顾</li>
                <li class="list-group-item"><span class="badge">2</span>恭喜抽中10元购物券（满100即可使用）</li>
                <li class="list-group-item"><span class="badge">3</span>谢谢惠顾</li>
                <li class="list-group-item"><span class="badge">4</span>恭喜抽中20元购物券（满200即可使用）</li>
                <li class="list-group-item"><span class="badge">5</span>谢谢惠顾</li>
                <li class="list-group-item"><span class="badge">6</span>恭喜抽中40元购物券（满300即可使用）</li>
            </ul>
        </div>

    </div>

    <!--<div class="fork-github ">
        <a href="https://github.com/givebest/GB-canvas-turntable ">Fork me on Github</a>
    </div>-->

    <script src="js/GB-canvas-turntable.js "></script>
    <script>
        var pool = ['谢谢惠顾', '10元', '谢谢惠顾', '20元', '谢谢惠顾', '40元'];
        var cond = ['', '（满100即可使用）', '', '（满200即可使用）', '', '（满300即可使用）'];
        var label = ['1', '2', '3', '4', '5', '6'];
        var prob = [0.23, 0.1, 0.23, 0.1, 0.24, 0.1];
        // var prob = [0.30, 0.03, 0.30, 0.03, 0.31, 0.03];
        var pseg = [];
        var pool_size = pool.length;

        for (var i = 0, sum = 0.0; i < pool_size; i++) {
            sum += prob[i];
            pseg.push(sum);
        }

        document.addEventListener('DOMContentLoaded', function() {
            gbTurntable.init({
                id: 'turntable',
                pool: pool,
                prob: prob,
                label: label,
                config: function(callback) {
                    // 获取奖品信息
                    callback && callback(pool, prob);
                },
                getPrize: function(callback) {
                    // 获取中奖信息
                    var lucky = Math.random();
                    console.log(lucky);
                    var num = 3; //奖品ID
                    // for (var i = 0; i < pool_size; ++i) {
                    //     if (lucky < pseg[i]) {
                    //         num = i;
                    //         break;
                    //     }
                    // }
                    var chances = 1; // 可抽奖次数
                    callback && callback([num, chances]);
                },
                gotBack: function(data) {
                    alert(data);
                    window.location.href = 'https://sojump.com/jq/14252417.aspx';
                }
            });
        }, false);
    </script>

    <script src="../../assets/js/jquery-1.12.4.min.js "></script>
    <script src="../../dist/js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
</body>

</html>